<?php session_start(); ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
$db_server = "localhost";
$db_name = "chrishsu_membership";
$db_user = "chrishsu_member";
$db_passwd = "membership";

if(!@mysql_connect($db_server, $db_user, $db_passwd))
        die("無法對資料庫連線");

//資料庫連線採UTF8
mysql_query("SET NAMES utf8");

//選擇資料庫
if(!@mysql_select_db($db_name))
        die("無法使用資料庫");

if($_SESSION['username'] != null)
{
	echo 'logged in as '.$_SESSION['username'].'<br>';
	echo '<a href="test_logout.php">登出</a>';
	echo '
		<form name="form" method="post" action="test_recommend.php">
		姓名：<input type="text" name="rec" /> <br>
		備註：<input type="text" name="comments" /> <br>
		<input type="submit" name="button" value="送出" />
		</form>';

}
else
{
        echo '您無權限觀看此頁面!';
        echo '<meta http-equiv=REFRESH CONTENT=2;url=test_login.html>';
}
?>
